<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        /* 通过循环按行顺序得到一个5×5的二维数组 赋值1到25的自然数，然后输出该数组的左下半三角。试编程。提示：多维数组，也就是数组里面的数据也是数组（二维数据），会涉及数据的存储区别 */

        var res = []
        var arr = []
        var num = 0
        for (var i = 1; i <= 25; i++) {
            res.push(i)
            num++
            if (num % 5 === 0) {
                arr.push(res)
                num = 0
                res = []
            }
        }
        console.log(arr)
        for (var i = 0; i < arr.length; i++) {
            for (var j = 0; j <= i; j++) {
                // console.log(arr[i][j] + '')
                document.write(arr[i][j] + ' ')
            }
            document.write('</br>')
        }
    </script>
</body>

</html>